home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Asm / AB3DIIsrc / amos / addtrans.amos / addtrans.amosSourceCode
Encoding:
AMOS Source Code  |  1997-01-08  |  1.9 KB  |  109 lines

  1. Screen Open 0,640,256,2,Hires
  2. Colour 1,$FFF
  3. Curs Off 
  4. RR1=15
  5. GG1=15
  6. BB1=15
  7. RR2=16
  8. GG2=16
  9. BB2=16
  10.  
  11. Dim O(7),S(7)
  12. O(0)=0
  13. O(1)=%11111
  14. S(0)=0
  15. S(1)=%100000
  16.  
  17. O(2)=0
  18. O(3)=%1111100000
  19. S(2)=0
  20. S(3)=%10000000000
  21.  
  22. O(4)=0
  23. O(5)=%111110000000000
  24. S(4)=0
  25. S(5)=32768
  26.  
  27. Repeat 
  28.    A$=Inkey$
  29.    Ink 0
  30.    Wait Vbl 
  31.    Bar 0,0 To 200,200
  32.    If A$="q" and RR1<31 Then Add RR1,1
  33.    If A$="w" and GG1<31 Then Add GG1,1
  34.    If A$="e" and BB1<31 Then Add BB1,1
  35.    If A$="r" and RR2<31 Then Add RR2,1
  36.    If A$="t" and GG2<31 Then Add GG2,1
  37.    If A$="y" and BB2<31 Then Add BB2,1
  38.    
  39.    If A$="a" and RR1>0 Then Add RR1,-1
  40.    If A$="s" and GG1>0 Then Add GG1,-1
  41.    If A$="d" and BB1>0 Then Add BB1,-1
  42.    If A$="f" and RR2>0 Then Add RR2,-1
  43.    If A$="g" and GG2>0 Then Add GG2,-1
  44.    If A$="h" and BB2>0 Then Add BB2,-1
  45.    
  46.    Locate 0,0
  47.  
  48.    Print RR1;GG1;BB1
  49.    Print RR2;GG2;BB2
  50.    
  51.    A=RR1*32*32+GG1*32+BB1
  52.    B=RR2*32*32+GG2*32+BB2
  53.    
  54.    Print Bin$(A)
  55.    Print Bin$(B)
  56.    
  57.    TEMP=A xor B
  58.    TEMP2=A+B
  59.    TEMP3=TEMP xor TEMP2
  60.    TEMP4=(TEMP3 and %100000)/%100000
  61.    TEMP2=TEMP2-S(TEMP4)
  62.    TEMP2=TEMP2 or O(TEMP4)
  63.    TEMP3=TEMP xor TEMP2
  64.    TEMP4=(TEMP3 and %10000000000)/%10000000000
  65.    TEMP2=TEMP2-S(TEMP4+2)
  66.    TEMP2=TEMP2 or O(TEMP4+2)
  67.    TEMP3=TEMP xor TEMP2
  68.    TEMP4=(TEMP3 and %1000000000000000)/%1000000000000000
  69.    TEMP2=TEMP2-S(TEMP4+4)
  70.    TEMP2=TEMP2 or O(TEMP4+4)
  71.    
  72.    A1=TEMP2
  73.    
  74.    Print Bin$(A1)
  75.    R=A1/(32*32)
  76.    G=(A1/32) and 31
  77.    B=(A1) and 31
  78.    Print R;G;B
  79.    
  80.    A=RR1*32*32+GG1*32+BB1
  81.    B=RR2*32*32+GG2*32+BB2
  82.    
  83.    R1=A and(31*32*32)
  84.    G1=A and(31*32)
  85.    B1=A and(31)
  86.    R2=B and(31*32*32)
  87.    G2=B and(31*32)
  88.    B2=B and(31)
  89.    R1=R1+R2
  90.    G1=G1+G2
  91.    B1=B1+B2
  92.    If R1>31*32*32 Then R1=31*32*32
  93.    If G1>31*32 Then G1=31*32
  94.    If B1>31 Then B1=31
  95.    TEMP=R1+G1+B1
  96.    
  97.    A2=TEMP
  98.    Print Bin$(A)
  99.    R=A2/(32*32)
  100.    G=(A2/32) and 31
  101.    B=(A2) and 31
  102.    Print R;G;B
  103.    
  104.    If A1<>A2
  105.       Print "DIE!!"
  106.       End 
  107.    End If 
  108.    
  109. Until 0